package MyCountDownLatch;

import MySemaphore.Fun;

import java.util.concurrent.CountDownLatch;

public class MyCountDownLatch {
    public static void main(String[] args) throws InterruptedException {
        CountDownLatch countDownLatch = new CountDownLatch(10);
        CountDownLatchFun count = new CountDownLatchFun();
        for (int i = 0; i < 10; i++) {
            new Thread(()->{
                count.fun();
                countDownLatch.countDown();
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }).start();
        }
        countDownLatch.await();
        System.out.println("公布成绩！");
    }
}
